<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Student Registration</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<?php
if (isset($_GET['ID'])) {
    include_once 'connect_DB.php';
    global $fname;
    global $surname;
    global $email;
    global $photo_url;
    $ID = $_GET['ID'];
    $query = mysqli_query($con, "SELECT * FROM user_db WHERE ID=$ID ");
    if (mysqli_num_rows($query) > 0) {
        while ($row = mysqli_fetch_array($query)) {
            $fname = $row['FIRST_NAME'];
            $surname = $row['SURNAME'];
            $email = $row['EMAIL'];
            $photo_url = $row['PHOTO_URL'];
        }
    } else {
        header("Location: index.php?messageError=\'User not found\''");
    }
} else {
    header("Location: index.php?messageError=\'User not found\''");
}
?>
<body>
<br>

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <div class="row">
                <div class="col-lg-6">
                    <h2>Profile</h2>
                </div>
            </div>
        </div>
        <div class="panel-body">
            <div class="row">
                <div class="col-sm-3">
                    <a role="button" href="liststudent.php" class="btn btn-info">Back to List of Students Page</a>
                </div>
            </div>
            <br>

            <div class="container">
                <div class="col-lg-3">
                    <div class="row">
                        <div class="col-sm-1">
                            <img class="thumbnail" src="<?php echo 'img/'.$photo_url ?>" width="200px;" height="200px;">

                        </div>
                    </div>
                </div>
                <div class="col-lg-5">
                    <div class="row">
                        <div class="col-sm-3">
                            <p style="font-weight: bold">FIRST NAME</p>
                        </div>
                        <div class="col-sm-3">
                            <p><?php echo $fname;// ?></p>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-3">
                            <p style="font-weight: bold">SURNAME</p>
                        </div>
                        <div class="col-sm-3">
                            <p> <?php echo $surname;// ?></p>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-3">
                            <p style="font-weight: bold">E-MAIL</p>
                        </div>
                        <div class="col-sm-3">
                            <p><?php echo $email;// ?></p>
                        </div>
                    </div>
                </div>
                <div class="col-lg-2"></div>
            </div>
        </div>
    </div>
</body>
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.js"></script>
</html>